package com.gumanx;

import cpw.mods.fml.common.network.Player;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;

public class ItemStaffTeleportation extends Item {

	public ItemStaffTeleportation(int par1) {
		super(par1);
		this.setCreativeTab(CreativeTabs.tabCombat);
	}

	public boolean hasEffect(ItemStack par1ItemStack) {
		return true;
	}

	public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World,
			EntityPlayer par3EntityPlayer) {
		MovingObjectPosition Coord = par3EntityPlayer.rayTrace(300, 1);
		if (Coord != null) {
			Vec3 look = par3EntityPlayer.getLookVec();
			par3EntityPlayer.setPosition(Coord.blockX - look.xCoord,
					Coord.blockY - look.yCoord, Coord.blockZ - look.zCoord);
		}
		return par1ItemStack;
	}

	public void registerIcons(IconRegister iconReg) {
		itemIcon = iconReg.registerIcon("gumanx:staffTeleportation");
	}

}